package com.ssm.demo2.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.ssm.demo2.mapper.UserMapper;
import com.ssm.demo2.po.User;
import com.ssm.demo2.service.impl.UserServiceImpl;

@Controller
@RequestMapping("/user")
public class UserController {
	/*@Autowired
	UserMapper userMapper;*/
	@Autowired
	UserServiceImpl userServie;
	
	@RequestMapping("/list")
	public ModelAndView  userlist() throws Exception{
//		List<User> users=userMapper.findUserList("王");
		List<User> users=userServie.findUser("刘");
		ModelAndView mView=new ModelAndView();
		mView.addObject("users",users);
		mView.setViewName("list");//返回的jsp页面名称
		return mView; 
	}
}
